package info.sean.service.impl;

import info.sean.domain.Account;
import info.sean.mapper.AccountMapper;
import info.sean.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

/**
 * 事务控制一定要记住在spring applicationContext.xml添加配置
 * @author Admin
 */
@Service
@Transactional
public class AccountServiceImpl implements AccountService {
    @Autowired
   private AccountMapper accountMapper;

    @Override
    public List<Account> findAll() {
        System.out.println("lan");
        return accountMapper.findAll();

    }

    @Override
    public void addAccount(Account account) {
        accountMapper.addAccount(account);
    }

    @Override
    public Account QueryAccountId(Integer id) {

        return accountMapper.QueryAccountId(id);


    }

    @Override
    public void UpdateAccount(Account account) {
        accountMapper.UpdateAccount(account);
//        int i = 1/0;
    }

    @Override
    public void deleteAccount(Integer id) {
        accountMapper.deleteAccount(id);
    }
}
